# https://gitee.com/yueyinqiu5990/codes-for-tj10053104/blob/master/supplement1/question5/point.py


class Point:
    def __init__(self, x: float, y: float):
        self._x = x
        self._y = y

    def x(self) -> float:
        return self._x

    def y(self) -> float:
        return self._y

    def distance_to(self, other: 'Point'):
        return ((other._x - self._x) ** 2 + (other._y - self._y) ** 2) ** 0.5


def _main():
    a_input = input("点A的坐标x,y：")
    b_input = input("点B的坐标x,y：")

    def parse(input_string: str) -> Point:
        x, y = map(float, input_string.split(","))
        return Point(x, y)

    a = parse(a_input)
    b = parse(b_input)
    print("AB距离为：", a.distance_to(b))


if __name__ == "__main__":
    _main()
